#include <chrono>


class Timer {
public:
  using time_type = std::chrono::high_resolution_clock::time_point;

  Timer() {
    Start();
  }

  ~Timer() {

  }

  void Start() {
    time_ = Now();
  }

  time_type Now() {
    return std::chrono::high_resolution_clock::now();
  }

  float ElapsedMs() {
    auto end_time = Now();
    return float(std::chrono::duration_cast<std::chrono::milliseconds>
      (end_time - time_).count());
  }

  float ElapsedMicros() {
    auto end_time = Now();
    return 1e-3f * float(std::chrono::duration_cast<std::chrono::microseconds>
      (end_time - time_).count());
  }

private:
  time_type time_;
};